import request from "@/router/axios";

export const getPage = (page, params) => {
  return request({
    url: "/admin/team/page",
    method: "get",
    params: {
      ...page,
      ...params,
    },
  });
};
//登录账号
export const updateLoginAccount = (params) => {
  return request({
    url: "/admin//team/updateLoginAccount",
    method: "post",
    data: {
      ...params,
    },
  });
};

export const getTeamdongfengPage = (page, params) => {
  return request({
    url: "/api/uic-business/teamdongfeng/page",
    method: "get",
    params: {
      ...page,
      ...params,
    },
  });
};

export const save = (form) => {
  return request({
    url: "/admin/team/save",
    method: "post",
    data: {
      ...form,
    },
  });
};

export const update = (form) => {
  return request({
    url: "/admin/team/update",
    method: "post",
    data: {
      ...form,
    },
  });
};

export const updateTeamFillMachine = (form) => {
  return request({
    url: "/api/uic-system/fillteam/updateTeamFillMachine",
    method: "post",
    data: {
      ...form,
    },
  });
};
export const unbindTeamFillMachine = (form) => {
  return request({
    url: "/api/uic-system/fillteam/unbindTeamFillMachine",
    method: "post",
    data: {
      ...form,
    },
  });
};

export const frozen = (id) => {
  return request({
    url: "/admin/team/updateUserStatus",
    method: "post",
    data: {
      id,
      teamStatus: 0,
    },
  });
};

export const unfrozen = (id) => {
  return request({
    url: "/admin/team/updateUserStatus",
    method: "post",
    data: {
      id,
      teamStatus: 1,
    },
  });
};

export const deleteRecord = (id) => {
  return request({
    url: "/admin/team/remove",
    method: "post",
    params: {
      ids: id,
    },
  });
};

export const resetPwd = (id) => {
  return request({
    url: "/admin/team/reset-password",
    method: "post",
    params: {
      teamId: id,
    },
  });
};

export const open = (id) => {
  return request({
    url: "/api/uic-system/fillteamaccount/updateUserStatus",
    method: "post",
    data: {
      teamId: id,
      userStatus: 0,
    },
  });
};

export const close = (id) => {
  return request({
    url: "/api/uic-system/fillteamaccount/updateUserStatus",
    method: "post",
    data: {
      teamId: id,
      userStatus: 1,
    },
  });
};

export const recordTeamdongfengDetail = (id) => {
  return request({
    url: "/api/uic-business/teamdongfeng/detail",
    method: "get",
    params: { id },
  });
};

export const recordDetail = (id) => {
  return request({
    url: "/admin/team/detail",
    method: "get",
    params: { id },
  });
};

export const fillTeamWaterRecordPage = (page, params) => {
  return request({
    url: "/api/uic-system/fillteamwaterrecord/page",
    method: "get",
    params: {
      ...page,
      ...params,
    },
  });
};

// 获取授权信息
export const fillTeamWaterSummary = (teamId) => {
  return request({
    url: `/api/uic-system/fillteamcard/${teamId}/summary`,
    method: "get",
  });
};

// 增加授信
export const addFillTeamWater = (teamId, balanceMoney) => {
  return request({
    url: `/api/uic-system/fillteamwaterrecord/save`,
    method: "post",
    data: {
      teamId,
      balanceMoney,
    },
  });
};
